#include<iostream>
using namespace std;

int main()
{
    int k;
    cin >> k;
    int a = 0;
    int count1=0,count5=0,count10=0;
    for(int i=0;i<k;i++)
    {
        cin >> a;
        if(a==1)
        {
            count1++;
        }
        else if(a==5)
        {
            count5++;
        }
        else if(a==10)
        {
            count10++;
        }
    }
    cout << count1 << endl << count5 << endl << count10 << endl;
    return 0;
}